package kr.hkit.androidcomplete01.chapter09;

import kr.hkit.androidcomplete01.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.SubMenu;
import android.widget.TextView;
import android.widget.Toast;

public class OptionMenuXml extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		TextView MyText = new TextView(this);
		MyText.setText("메뉴 키를 누르세요.");
		setContentView(MyText);
	}
	
	public boolean onCreateOptionsMenu(Menu menu){
		super.onCreateOptionsMenu(menu);
		
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.optionmenu, menu);
		return true;

	}
	
	public boolean onOptionsItemSelected(MenuItem item){
		switch (item.getItemId()){
		case R.id.jjajang:
			Toast.makeText(this, "짜장은 달콤하다해", Toast.LENGTH_SHORT).show();
			return true;
		case R.id.jjambbong:
			Toast.makeText(this, "짬뽕은 맵다해", Toast.LENGTH_SHORT).show();
			return true;
		case R.id.udong:
			Toast.makeText(this, "우동은 시원하다해", Toast.LENGTH_SHORT).show();
			return true;
		case R.id.mandoo:
			Toast.makeText(this, "만두는 서비스다해", Toast.LENGTH_SHORT).show();
			return true;			
		}
		
		return false;
		
	}
}
